<template>
	<view class="mainPage article-details" :style="{'padding-top': `${$store.state.safeArea.top || 0}px`, 'padding-bottom': `${$store.state.safeArea.bottom || 0}px`}">
		<public-head :title="title"></public-head>
		<view class="box" v-if="info">
			<view class="box1">
				<view class="name">
					{{info.petname}}
				</view>
				<view class="list">
					<view class="item">
						性别：<text>{{info.sex}}</text>
					</view>
					<view class="item">
						年龄：<text>{{info.age}}</text>
					</view>
					<view class="item">
						体重：<text>{{info.weight}}kg</text>
					</view>
					<view class="item">
						种类：<text>{{info.race == 0 ? '其他' : (info.race == 1 ? '猫' : '狗')}}</text>
					</view>
					<view class="item">
						品种：<text>{{info.varieties}}</text>
					</view>
					<view class="item">
						绝育：<text>{{info.is_sterilization}}</text>
					</view>
				</view>
			</view>
			<view class="box2">
				<view class="top">
					<view class="left">
						<text class="miaoshu">症状描述</text>
						<text class="time">{{info.en_time}}</text>
					</view>
					<view class="right">
						{{info.consultation_type}}
					</view>
				</view>
				<view class="bottom">
					{{info.describe}}
				</view>
			</view>
			<view class="box3" v-show="info.describe_img != ''">
				<view class="title">
					症状描述
				</view>
				<view class="img-box" v-if="info.describe_type==1">
					<template v-for="(it,i) in info.describe_img">
						<view class="item" :key="i" v-if="i<3">
							<image :src="it"  mode="aspectFill" @click="chakan(i)"></image>
							<view class="dingwei" v-if="i==2&&info.describe_img.length>3">{{info.describe_img.length}}</view>
						</view>
					</template>
				</view>
				<view class="img-box video-box" v-if="info.describe_type==2">
					<view class="item" v-for="(it,i) in info.describe_img" :key="i" @click="jumpvideo(it)">
						<image :src="info.describe_coverimg"  mode="aspectFill" ></image>
					</view>
				</view>
			</view>
			
		</view>

	</view>
</template>

<script>
	var that
	import publicHead from "@/components/publicHead/publicHead.vue"
	export default {
		components: {
			publicHead
		},
		data() {
			return {
				title: '症状详情描述',
				info:{}
			}
		},
		onLoad(options) {
			that=this
			let id = options.id
			that.postData(id)
		},
		methods: {
			postData(id){
				that.$postAjax1('Doctorsside_symptom',{
					order_id:id    //订单编号
				},function(data){  //https://ask.suoweilai.com/Doctorsside_symptom  医生端接诊 - 接诊-症状详细描述
					console.log(data.data.data,'宠物详情')
					that.info = data.data.data
				})
			},
			chakan(e){
				 // 预览图片
				uni.previewImage({
					urls: that.info.describe_img,
					current:e,
					longPressActions: {
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
			jumpvideo(src){
				uni.navigateTo({
					url:"../../browseVideo/browseVideo?src=" + src
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.box{
	padding: 20rpx 32rpx;
	.box1{
		padding: 22rpx 32rpx 6rpx;
		width: 100%;
		background: #FFFFFF;
		box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(97, 123, 185, 0.07);
		border-radius: 8rpx;
		margin-bottom: 16rpx;
		.name{
			font-size: 28rpx;
			font-weight: 500;
			color: #343434;
			line-height: 40rpx;
			margin-bottom: 18rpx;
			text-align: center;
		}
		.list{
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			.item{
				width: 35%;
				margin-bottom: 28rpx;
				font-size: 28Rpx;
				font-weight: 400;
				color: #959595;
				line-height: 40rpx;
				text{
					margin-left: 6rpx;
					font-size: 26rpx;
					font-weight: 400;
					color: #242424;
					line-height: 36rpx;
				}
			}
		}
	}

	.box2{
		width: 100%;
		// height: 248rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(97, 123, 185, 0.07);
		border-radius: 8rpx;
		margin-bottom: 16rpx;
		.top{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 28rpx 32rpx 20rpx 26rpx;
			border-bottom: 2rpx solid rgba(0,0,0,0.08);
			.left{
				.miaoshu{
					font-size: 28rpx;
					font-weight: 400;
					color: #242424;
					line-height: 40rpx;
					vertical-align: middle;
				}
				.time{
					font-size: 24rpx;
					font-weight: 400;
					color: #959595;
					line-height: 34rpx;
					vertical-align: middle;
					margin-left: 20rpx;
				}
			}
			.right{
				font-size: 28rpx;
				font-weight: 400;
				color: #FE871D;
				line-height: 40rpx;
			}
		}
		.bottom{
			padding: 30rpx 120rpx 60rpx 26rpx;
			font-size: 24rpx;
			font-weight: 400;
			color: #959595;
			line-height: 34rpx;
		}
	}
	
	.box3{
		width: 100%;
		background: #FFFFFF;
		box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(97, 123, 185, 0.07);
		border-radius: 8rpx;
		.title{
			font-size: 28rpx;
			font-weight: 400;
			color: #242424;
			line-height: 40rpx;
			padding: 28rpx 0 20rpx 26rpx;
			border-bottom: 2rpx solid rgba(0,0,0,0.08);
		}
		.img-box{
			padding: 18rpx 24rpx 28rpx;
			display: flex;
			flex-wrap: wrap;
			.item{
				width: calc((100% -18rpx - 18rpx)/3);
				height: 248rpx;
				position: relative;
				image{
					width: 100%;
					height: 100%;
					border-radius: 8rpx;
				}
				.dingwei{
					position: absolute;
					bottom: 0;
					right: 0;
					width: 76rpx;
					height: 30rpx;
					background: rgba(0, 0, 0, 0.69);
					border-radius: 8rpx;
					font-size: 20rpx;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 30rpx;
					text-align: center;
				}
			}
		}
		.video-box{
			.item{
				position: relative;
				&::after {
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
					z-index: 99;
					content: "";
					display: block;
					width: 60rpx;
					height: 60rpx;
					border-radius: 50%;
					background: url(https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng/img/medical/inquiry/shipinbiao.png) no-repeat;
					background-size: cover;
				}
			}
		}
	}
}
</style>
